package com.itheima.mArray;

import java.util.Scanner;

/*
  评委打分
 */
public class ArrayWork06 {
    public static void main(String[] args) {
        int[] arr = new int[6];
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        //引导评委输入
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请第" + (i + 1) + "位评委打分:");
            int score = sc.nextInt();
            if (score > 0 && score <= 100) {
                arr[i] = score;
            } else {
                System.out.println("您的输入有误,请重新输入!");
                i--;
            }
            sum += arr[i];
        }
        int max = arr[0];
        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        int ave = 0;
        ave =  (sum - max - min) / 4;
        System.out.println("平均分是:" + ave);
    }
}
